# CMake 最低版本号要求
cmake_minimum_required (VERSION 2.8)

project(Driver)

set (CMAKE_INSTALL_PREFIX /opt/ECG)
INCLUDE_DIRECTORIES( /opt/ECG/include)

if(INSTALL_HEAD_FILE_ONLY)

message(STATUS "just install head files...")

install(FILES inc/ADC_driver.h DESTINATION include/driver)


else(INSTALL_HEAD_FILE_ONLY)
message(STATUS "compile project...")

set(CMAKE_BUILD_TYPE "Debug")
set(CMAKE_CXX_FLAGS_DEBUG "$ENV{CXXFLAGS} -O0 -Wall -g -DBOOST_LOG_DYN_LINK -rdynamic -std=c++11")
set(CMAKE_CXX_FLAGS_RELEASE "$ENV{CXXFLAGS} -O3 -Wall -DBOOST_LOG_DYN_LINK -rdynamic -std=c++11")

set(BOOST_LIB_DIR /usr/local/lib/boost)
find_library(boost_log libboost_log.so ${BOOST_LIB_DIR})
find_library(boost_system libboost_system.so ${BOOST_LIB_DIR})

set(ADC_SRC src/ADC_driver.cpp)
add_library(ADC_driver SHARED ${ADC_SRC})
target_link_libraries(ADC_driver log ${boost_log} ${boost_system} dl)

install(TARGETS ADC_driver DESTINATION lib/driver)

endif(INSTALL_HEAD_FILE_ONLY)